import React, {Component} from 'react'
export default class BaseModal extends Component{

    constructor(props){
        super(props);
    }

    close(){
        global.popupView.pop();
        global.app.setState({});
        if (this.props.onClose){
            this.props.onClose();
        }
        document.body.removeEventListener('touchmove',(e)=>e.preventDefault(),false);
        $("body").css({"position":"initial"});
    }


    componentWillUnmount(){
        this.close();
    }


    renderContent(){
        return null;
    }

    render(){
        return <div style={{position: 'fixed',left:0,right:0,height: '100%',top:0,zIndex:1000}}>
                    <div style={{position: 'absolute', opacity: 0.6, backgroundColor: 'black', width: '100%', height: '100%'}}/>
                {this.renderContent()}
            </div>
    }
}